package unit19.numberFormat;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import java.util.Locale;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

public class NumberFormatFrame extends JFrame {
	private Locale[] locales;
	private double currentNumber;
	private JComboBox<String> localeCombo=new JComboBox<>();
	private JButton parseButton=new JButton("Parse");
	private JTextField numberText=new JTextField(30);
	private JRadioButton numberRadioButton=new JRadioButton("Number");
	private JRadioButton currentRadioButton=new JRadioButton("Current");
	private JRadioButton percentRadioButton=new JRadioButton("Percent");
	private ButtonGroup rbGroup=new ButtonGroup();
	private NumberFormat currentNumberFormat;
	
	public NumberFormatFrame() {
		// TODO Auto-generated constructor stub
		setLayout(new GridLayout());
		
		ActionListener listener=new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				updateDisplay();
			}
		};
		JPanel p=new JPanel();
		addRadioButton(p,numberRadioButton,rbGroup ,listener);
		addRadioButton(p, currentRadioButton, rbGroup, listener);
		addRadioButton(p, percentRadioButton, rbGroup, listener);
		
		add(new JLabel("Locale:"),new GBC(0,0).setAnchor(GBC.EAST));
	}
	private void addRadioButton(JPanel p, JRadioButton numberRadioButton2, ButtonGroup rbGroup2,
			ActionListener listener) {
		// TODO Auto-generated method stub
		
	}
	private void updateDisplay() {
		// TODO Auto-generated method stub
		
	}
}
